<UserControl x:Name="metaEditor" x:Class="Assembly.Metro.Controls.PageTemplates.Games.Components.MetaEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Assembly.Metro.Controls.PageTemplates.Games.Components"
             xmlns:MetaComps="clr-namespace:Assembly.Metro.Controls.PageTemplates.Games.Components.MetaComponents"
             xmlns:MetaData="clr-namespace:Assembly.Metro.Controls.PageTemplates.Games.Components.MetaData"
             mc:Ignorable="d"
             
             d:DesignHeight="600" d:DesignWidth="1000" KeyDown="metaEditor_KeyDown">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="MetaComponents/ComponentDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid Name="gridSearch" Height="35" VerticalAlignment="Top" HorizontalAlignment="Stretch">
            <Border BorderThickness="0,0,0,1" BorderBrush="#434346" Background="#FF303032">
                <DockPanel VerticalAlignment="Center">
                    <TextBlock Text="Search:" Style="{DynamicResource GenericTextblock}" VerticalAlignment="Center" Margin="10,0,0,0" />
                    <TextBox Name="txtSearch" Margin="10,0,0,0" Width="250" TextChanged="txtSearch_TextChanged_1" />
                    <Button Name="btnResetSearch" Margin="5,0,0,0" Content="Reset" Width="64" Click="btnResetSearch_Click_1" IsEnabled="False" />
                    <Button Name="btnPreviousResult" Margin="5,0,0,0" Content="Previous" Width="64" Click="btnPreviousResult_Click_1" IsEnabled="False" />
                    <Button Name="btnNextResult" Margin="5,0,0,0" Content="Next" Width="64" Click="btnNextResult_Click_1" IsEnabled="False" />
                    <ComboBox Name="comboSearchResults" Margin="5,0,5,0" IsEnabled="False" SelectionChanged="comboSearchResults_SelectionChanged_1">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Field.Name}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </DockPanel>
            </Border>
        </Grid>
        <ListBox Name="panelMetaComponents" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,35,0,35"
                  VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard" ScrollViewer.CanContentScroll="True"
                  Padding="0,15,0,15" SelectionChanged="panelMetaComponents_SelectionChanged_1">
            <ListBox.Template>
                <ControlTemplate>
                    <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
                        <ItemsPresenter />
                    </ScrollViewer>
                </ControlTemplate>
            </ListBox.Template>
            <ListBox.ItemContainerStyle>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid Background="{TemplateBinding ListBoxItem.Background}">
                                    <ContentPresenter Name="PART_Content" 
                                                      Content="{TemplateBinding ContentControl.Content}"
                                                      Margin="20,0,20,0"
                                                      ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                                                      ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
                                                      HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                                                      SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True">
                                        <Setter Property="Background" Value="#FF181818" />
                                    </DataTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
        <!--<TreeView Name="panelMetaComponents" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,30,0,35"
                  VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" ScrollViewer.CanContentScroll="True"
                  Padding="0,0,0,0">
            <TreeView.Template>
                <ControlTemplate>
                    <ScrollViewer Focusable="False">
                        <ItemsPresenter />
                    </ScrollViewer>
                </ControlTemplate>
            </TreeView.Template>
            <TreeView.ItemContainerStyle>
                <Style TargetType="{x:Type TreeViewItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}"
                                                  ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}"
                                                  ContentStringFormat="{TemplateBinding HeaderedItemsControl.HeaderStringFormat}"
                                                  ContentSource="Header"
                                                  Name="PART_Header"
                                                  HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                                  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </TreeView.ItemContainerStyle>
        </TreeView>-->
        <Grid Height="35" VerticalAlignment="Bottom" HorizontalAlignment="Stretch">
            <Border BorderThickness="0,1,0,0" BorderBrush="#434346" Background="#FF303032">
                <Grid>
                    <StackPanel Orientation="Horizontal">
                        <Button x:Name="btnPluginSave" ToolTip="Save the meta to the map file. (Ctrl + S)" Content="Save Meta" Width="80" Margin="10,0,0,0" Click="btnPluginSave_Click"/>
                        <Button x:Name="btnPluginPokeAll" ToolTip="Poke all the meta to the map file in memory. (Ctrl + Shift + P)" Content="Poke Complete Meta" Width="140" Margin="10,0,0,0" Click="btnPluginPokeAll_Click"/>
                        <Button x:Name="btnPluginPokeChanged" ToolTip="Poke changed meta to the map file in memory. (Ctrl + P)" Content="Poke Changed Meta" Width="140" Margin="10,0,0,0" Click="btnPluginPokeChanged_Click"/>
                        <Button x:Name="btnPluginRefresh" ToolTip="Refresh the plugin. (Ctrl + R)" Content="Refresh Plugin" Width="105" Margin="10,0,0,0" Click="btnPluginRefresh_Click"/>
                        <Button x:Name="btnPluginRevisionViewer" ToolTip="View who researched the plugin and what they did. (Ctrl + Shift + R)" Content="Revision Viewer" Width="110" Margin="10,0,0,0" Click="btnPluginRevisionViewer_Click"/>
                    </StackPanel>
                    <CheckBox x:Name="cbShowInvisibles" Content="Show Invisibles" Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Center" VerticalContentAlignment="Center" Checked="cbShowInvisibles_Altered" Unchecked="cbShowInvisibles_Altered" />
                </Grid>
            </Border>
        </Grid>
    </Grid>
</UserControl>
